

;
; file: myjump.asm
; my first asm program to realize the jump

%include "asm_io.inc"
segment .data
;
; initialized data is put in the data segment here
;
prompt1 db    "Enter a number: ", 0       ; don't forget nul terminator

segment .bss
;
; uninitialized data is put in the bss segment
;
input1  resd 1

 

segment .text
        global  asm_main
asm_main:
        enter   0,0               ; setup routine
        pusha

;
; code is put in the text segment. Do not modify the code before
; or after this comment.
;
        mov     eax, prompt1      ; print out prompt
        call    print_string

        call    read_int          ; read integer
        mov     [input1], eax     ; store into input1

        mov     eax, [input]

; here my logic is:
; if (eax>0) 
;   print "positive number!"
; else
;   print "negative number!"

        cmp     eax,0
        ;TODO:

        mov     eax, prompt1      ; print out po
        call    print_string


        popa
        mov     eax, 0            ; return back to C
        leave                     
        ret


